class GarantiasController < ApplicationController
  # GET /garantias
  # GET /garantias.xml
  def index
    @garantias = Garantia.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @garantias }
    end
  end

  # GET /garantias/1
  # GET /garantias/1.xml
  def show
    @garantia = Garantia.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @garantia }
    end
  end

  # GET /garantias/new
  # GET /garantias/new.xml
  def new
    @garantia = Garantia.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @garantia }
    end
  end

  # GET /garantias/1/edit
  def edit
    @garantia = Garantia.find(params[:id])
  end

  # POST /garantias
  # POST /garantias.xml
  def create
    @garantia = Garantia.new(params[:garantia])

    respond_to do |format|
      if @garantia.save
        flash[:notice] = 'Garantia was successfully created.'
        format.html { redirect_to(@garantia) }
        format.xml  { render :xml => @garantia, :status => :created, :location => @garantia }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @garantia.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /garantias/1
  # PUT /garantias/1.xml
  def update
    @garantia = Garantia.find(params[:id])

    respond_to do |format|
      if @garantia.update_attributes(params[:garantia])
        flash[:notice] = 'Garantia was successfully updated.'
        format.html { redirect_to(@garantia) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @garantia.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /garantias/1
  # DELETE /garantias/1.xml
  def destroy
    @garantia = Garantia.find(params[:id])
    @garantia.destroy

    respond_to do |format|
      format.html { redirect_to(garantias_url) }
      format.xml  { head :ok }
    end
  end
end
